// pages/Assemble/Assemble.js
const util = require('../../utils/util.js');
const api = require('../../config/api.js');
const user = require('../../utils/user.js');
var app = getApp();

Page({

  /**
   * 页面的初始数据
   */
  data: {
    TabCur: 0,
    scrollLeft: 0,
    tab:[
      {name:'拼团中'}
    ],
    list:[
      {
        src:'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2950912510,112818974&fm=26&gp=0.jpg',
        name:'苹果',
        num:1,
        price:12.1,
        price1:23
      },
      {
        src: 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=2950912510,112818974&fm=26&gp=0.jpg',
        name: '苹果',
        num: 1,
        price: 12.1,
        price1: 23
      }
    ]
  },
  tabSelect(e) {
    this.setData({
      TabCur: e.currentTarget.dataset.id,
      scrollLeft: (e.currentTarget.dataset.id - 1) * 60
    })
  },
  go(e) {
    console.log(e)
    wx.navigateTo({
      url: '../ptgoods/ptgoods?id=' + e.target.dataset.id,
    })
  },
  getshop() {
    let that = this
    util.request(api.QueryGroupList, {},'post',{
      'Content-Type': 'application/x-www-form-urlencoded;charset=UTF-8',
    }).then(function (res) {
      console.log(res)
      that.setData({
        list: res.data.groupList
      });
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.getshop()
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})